-
Notifications
You must be signed in to change notification settings - Fork 535
feat: add GuardrailsAI community integration #1298
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
ab11205
to
71b4a0b
Compare
71b4a0b
to
a12dc8a
Compare
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## develop #1298 +/- ##
===========================================
- Coverage 71.68% 71.62% -0.07%
===========================================
Files 168 171 +3
Lines 16862 17020 +158
===========================================
+ Hits 12088 12191 +103
- Misses 4774 4829 +55
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
Hi Pouyan! This looks great, happy to work on it here. I think I just need to pull down/test through |
tested this out, it looks great! |
ef55f83
to
c03679a
Compare
Thank you @zsimjee, merged. It will be part of 0.16.0 release. |
This pull request introduces a new integration for Guardrails AI validators into the NeMo Guardrails framework. It adds support for configuring, registering, and invoking Guardrails AI validators on both input and output text, along with robust error handling and dynamic validator loading. The changes span configuration, core logic, error handling, flow definitions, and registry management.
The most important changes are:
Guardrails AI Validator Integration & Core Logic:
GuardrailsAIRailConfig
andGuardrailsAIValidatorConfig
innemoguardrails/rails/llm/config.py
to allow users to specify and configure multiple Guardrails AI validators, including parameters and metadata. Added a method for retrieving validator configs by name. [1] [2]nemoguardrails/library/guardrails_ai/actions.py
, including caching, error handling, and mapping of validation results to the NeMo Guardrails format. Added two main actions:validate_guardrails_ai_input
andvalidate_guardrails_ai_output
.Configuration & Flow Integration:
examples/configs/guardrails_ai/config.yml
demonstrating how to specify models and set up input/output validation flows using Guardrails AI validators.flows.co
andflows.v1.co
) to check input and output text with the specified validators, handling failures by either raising exceptions or refusing to respond. [1] [2]Validator Registry & Error Handling:
nemoguardrails/library/guardrails_ai/registry.py
for mapping validator names to their module/class/hub paths, and logic to fetch validator info from Guardrails Hub if not found in the local registry.nemoguardrails/library/guardrails_ai/errors.py
for handling configuration and validation errors, with graceful fallback if Guardrails is not installed.Miscellaneous:
__init__.py
, actions, errors, registry) [1] [2] [3] [4]These changes collectively enable seamless integration of Guardrails AI validators into the NeMo Guardrails ecosystem, with flexible configuration, dynamic loading, and robust flow control.